package imp.core.basics.date;


/**
 * This class is used for representing a time.
 * @author Patrick Arnold
 * @since 09.09.2010
 *
 */
public class Time {

	/** The second of the time. */
	private int second;
	
	/** The minute of the time. */
	private int minute;
	
	/** The hour of the time. */
	private int hour;

	
	
	/**
	 * Constructor - Creates a new time.
	 * @param hour The hour of the time.
	 * @param minute The minute of the time.
	 * @param second The second of the time.
	 */
	public Time( int hour, int minute, int second) {
		this.hour = hour;
		this.minute = minute;
		this.second = second;
	}
	
	
	/**
	 * Constructor - Creates a new time.
	 * @param hour The hour of the time.
	 * @param minute The minute of the time.
	 */
	public Time( int hour, int minute) {
		this.hour = hour;
		this.minute = minute;
	}


	
	/**
	 * Returns the second of the time.
	 * @return The second of the time.
	 */
	public int getSecond() {
		return second;
	}


	/**
	 * Returns the minute of the time.
	 * @return The minute of the time.
	 */
	public int getMinute() {
		return minute;
	}


	/**
	 * Returns the hour of the time.
	 * @return The hour of the time.
	 */
	public int getHour() {
		return hour;
	}
	
	
	/**
	 * Returns the time in the form HH:MM:SS
	 * @return The time in the form of HH:MM:SS
	 */
	public String getTime() {
		
		String hh_str = "" + hour;
		if( hour < 10) {
			hh_str = "0" + hh_str;
		}
		
		String mm_str = "" + minute;
		if( minute < 10) {
			mm_str = "0" + mm_str;
		}
		
		String ss_str = "" + second;
		if( second < 10) {
			ss_str = "0" + ss_str;
		}
		
		String time = hh_str + ":" + mm_str + ":" + ss_str;
		
		return time;
		
	}
	
	
}